﻿namespace Development.Network.Msg
{
    /// <summary>
    /// 流接口
    /// </summary>
    public interface ISn
    {
        void Sn(MsgSn sn);

        void Usn(MsgUsn usn);

    }
    /// <summary>
    /// 
    /// </summary>
    public  class StreamMsg : MsgBase, ISn
    {
        protected override void WriteMsgId()
        {
            base.WriteMsgId();
        }
        public override byte[] Pack()
        {
            MsgSn sn = new MsgSn();
            //为长度占位
            sn.Write(0);
            sn.Write(_MsgId);
            sn.Write(_UserId);
            sn.Write(_Status);
            Sn(sn);
            _Lenth = sn.CalcLen();
            return sn.GetMsg();
        }

        public override void Unpack(MsgPacket packet)
        {
            base.Unpack(packet);
            MsgUsn usn = new MsgUsn(packet.Data);
            Usn(usn);
        }

        public virtual  void Sn(MsgSn sn)
        {
        }
        public virtual  void Usn(MsgUsn usn)
        {

        }
    }
}
